# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

RESTRICT="nomirror"

GIZMO_VER="1.0.0.18-1_debian"
SIPPHONE_VER2="0.78.20060211"
SIPPHONE_VER="${SIPPHONE_VER2}-1"

inherit eutils

DESCRIPTION="Gizmo is a P2P-VoiceIP client"
HOMEPAGE="http://www.gizmoproject.com/"
SRC_URI="http://www.gizmoproject.com/GizmoDownload/gizmo-project_${GIZMO_VER}_i386.deb
	http://www.gizmoproject.com/GizmoDownload/libsipphoneapi_alsa_${SIPPHONE_VER}_i386.deb"
LICENSE="gizmoproject-eula"
SLOT="0"
KEYWORDS="~x86"
IUSE=""

DEPEND="app-arch/deb2targz"

RDEPEND="amd64? ( app-emulation/emul-linux-x86-glibc
		>=app-emulation/emul-linux-x86-xlibs-1.2
		>=app-emulation/emul-linux-x86-baselibs-2.1.1 )
	>=media-libs/gdk-pixbuf-0.2
	>=media-libs/tiff-3
	>=dev-libs/libxml2-2
	>=gnome-base/libglade-2
	>=gnome-base/orbit-2
	>=gnome-base/gconf-2
	>=dev-libs/openssl-0.9.7
	>=x11-libs/gtk+-2
	media-libs/freetype
	net-misc/mDNSResponder
	net-misc/curl
	net-dns/libidn
	dev-libs/expat
	dev-libs/atk
	x11-libs/pango
	virtual/x11"

S="${WORKDIR}"

src_unpack() {
	cp ${DISTDIR}/gizmo-project_${GIZMO_VER}_i386.deb .
	cp ${DISTDIR}/libsipphoneapi_alsa_${SIPPHONE_VER}_i386.deb .
	deb2targz gizmo-project_${GIZMO_VER}_i386.deb
	deb2targz libsipphoneapi_alsa_${SIPPHONE_VER}_i386.deb
	tar xzf gizmo-project_${GIZMO_VER}_i386.tar.gz
	tar xzf libsipphoneapi_alsa_${SIPPHONE_VER}_i386.tar.gz
}

src_install() {
	exeinto /usr/bin
	doexe usr/bin/gizmo

	dolib.so usr/lib/libsipphonesslopsapi.so.${SIPPHONE_VER2}
	dolib.so usr/lib/libsipphoneapi.so.${SIPPHONE_VER2}
	dosym libsipphonesslopsapi.so.${SIPPHONE_VER2} /usr/$(get_libdir)/libsipphonesslopsapi.so
	dosym libsipphoneapi.so.${SIPPHONE_VER2} /usr/$(get_libdir)/libsipphoneapi.so

	dodoc usr/share/doc/gizmo-project/*
	docinto libsipphoneapi
	dodoc usr/share/doc/libsipphoneapi/*

	insinto /usr/share
	doins -r usr/share/gizmo
	doins -r usr/share/libsipphoneapi

	make_desktop_entry gizmo "Gizmo VoIP" gizmo
	insinto /usr/share/icons/hicolor/48x48/apps
	newins usr/share/gizmo/pixmaps/icons/gizmo-icon-48.png gizmo.png

	[[ ! -f "${ROOT}/usr/$(get_libdir)/libexpat.so.1" ]] && dosym libexpat.so /usr/$(get_libdir)/libexpat.so.1
	[[ ! -f "${ROOT}/usr/$(get_libdir)/libtiff.so.4" ]] && dosym libtiff.so /usr/$(get_libdir)/libtiff.so.4
}
